﻿using System;
namespace CSExample {
	public class ActionDemo {

		public delegate int del (int i);

		public ActionDemo () {
			
		}

		public static void Run () {
			Console.WriteLine ("ActionDemo");

			var demo = new ActionDemo ();
			//del myDelegate = (x) => { return x * x; };
			demo.callParam ((x) => { return x * x; });


			CallAction (Action, "hello world");
			CallAction ((s) => { Console.WriteLine (s); }, "hello 2");
		}

		public void callParam (del a) {
			Console.WriteLine (a (5));
		}

		public static void CallAction<T> (Action<T> action, T p) {
			action (p);
		}

		public static void Action(string a) {
			Console.WriteLine (a);
		}
	}
}
